<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>地图列表</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="../css/youyi.css"/>
	</head>
	<body class="map_list_sub">
		<!--下拉刷新容器-->
		<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
			<div class="mui-scroll">
				<!--数据列表-->
				<ul class="mui-table-view" id="contact_info_more">
				</ul>
			</div>
		</div>
		<script src="../js/mui.min.js"></script>
		<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script>
			mui.init({
				keyEventBind: {
					backbutton: false,  //Boolean(默认true)关闭back按键监听
					menubutton: false   //Boolean(默认true)关闭menu按键监听
				},
				pullRefresh:{
					container:'#pullrefresh',
					down:{
						callback: pulldownRefresh
					},
					up:{
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				}
			});
			//添加列表项的点击事件
			mui.ready(function(){
				document.getElementById("contact_info_more").addEventListener("tap",function(){
			   		mui.openWindow("business_details.html");
			   });
			});
			
			/*** 下拉刷新具体业务实现*/
			var isAddCl=false;
			function pulldownRefresh() {
				setTimeout(function() {
					var table = document.body.querySelector('.mui-table-view');
					var cells = document.body.querySelectorAll('.mui-table-view-cell');
					for (var i = cells.length, len = i + 3; i < len; i++) {
						var li = document.createElement('li');
							li.className = 'mui-table-view-cell mui-media';
						var liHTML ='<a href="javascript:;" class="clear" id="'+i+'">';
							liHTML +='<div class="tab_view_left mui-pull-left">';
							liHTML +='<img class="mui-media-object" src="../images/environmenMap/map_list_left.png">';
							liHTML +='<p class="xingxing_p">';
							liHTML +='<span class="xinxin">';
							liHTML +='<i class="xinxin_item"><img src="../images/environmenMap/xingxing_bg.png"></i>';
							liHTML +='<i class="xinxin_item"><img src="../images/environmenMap/xingxing_bg.png"></i>';
							liHTML +='<i class="xinxin_item"><img src="../images/environmenMap/xingxing_bg.png"></i>';
							liHTML +='<i class="xinxin_item"><img src="../images/environmenMap/xingxing_bg.png"></i>';
							liHTML +='</span>';
							liHTML +='</p>';
							liHTML +='<p class="rec_index"><span class="ammount">推荐指数：85%</span></p>';
							liHTML +='</div>';
							liHTML +='<div class="mui-media-body mui-pull-left">';
							liHTML +='<h1 class="com_dtl_h"><span>'+i+'广州市广清环保设备有限公司</span><small>(环保工程)</small></h1>';
							liHTML +='<p class="mui-ellipsis the_main">下拉主营行业：环保项目（水/电）</p>';
							liHTML +='<p class="mui-ellipsis the_city">城市：广东省-广州市</p>';
							liHTML +='<p class="cmpy_label">';
							liHTML +='<span class="cmpy_lbl_item green">优蚁认证</span>';
							liHTML +='<span class="cmpy_lbl_item blue">协会认证</span>';
							liHTML +='<span class="cmpy_lbl_item yellow">工商认证</span>';
							liHTML +='<span href="javascript:;" class="online_msg">在线留言</span>';
							liHTML +='</p>';
							liHTML +='</div>';
							liHTML +='</a>';
						li.innerHTML = liHTML;						//下拉刷新，新纪录插到最前面；
						table.insertBefore(li, table.firstChild);						
					};
					//showDivSub(isAddCl);
					mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
				},500);
			}
			var count = 0;
			/** * 上拉加载具体业务实现*/
			function pullupRefresh() {
				setTimeout(function() { 
					mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > 2)); //参数为true代表没有更多数据了。
					var table = document.body.querySelector('.mui-table-view');
					var cells = document.body.querySelectorAll('.mui-table-view-cell');
					for (var i = cells.length, len = i + 12; i < len; i++) {
						var li = document.createElement('li');
							li.className = 'mui-table-view-cell mui-media';
						var liHTML ='<a href="javascript:;" class="clear" id="'+i+'">';
							liHTML +='<div class="tab_view_left mui-pull-left">';
							liHTML +='<img class="mui-media-object" src="../images/environmenMap/map_list_left.png">';
							liHTML +='<p class="xingxing_p">';
							liHTML +='<span class="xinxin">';
							liHTML +='<i class="xinxin_item"><img src="../images/environmenMap/xingxing_bg.png"></i>';
							liHTML +='<i class="xinxin_item"><img src="../images/environmenMap/xingxing_bg.png"></i>';
							liHTML +='<i class="xinxin_item"><img src="../images/environmenMap/xingxing_bg.png"></i>';
							liHTML +='<i class="xinxin_item"><img src="../images/environmenMap/xingxing_bg.png"></i>';
							liHTML +='</span>';
							liHTML +='</p>';
							liHTML +='<p class="rec_index"><span class="ammount">推荐指数：85%</span></p>';
							liHTML +='</div>';
							liHTML +='<div class="mui-media-body mui-pull-left">';
							liHTML +='<h1 class="com_dtl_h"><span>'+i+'广州市广清环保设备有限公司</span><small>(环保工程)</small></h1>';
							liHTML +='<p class="mui-ellipsis the_main">上拉主营行业：环保项目（水/电）</p>';
							liHTML +='<p class="mui-ellipsis the_city">城市：广东省-广州市</p>';
							liHTML +='<p class="cmpy_label">';
							liHTML +='<span class="cmpy_lbl_item green">优蚁认证</span>';
							liHTML +='<span class="cmpy_lbl_item blue">协会认证</span>';
							liHTML +='<span class="cmpy_lbl_item yellow">工商认证</span>';
							liHTML +='<span href="javascript:;" class="online_msg">在线留言</span>';
							liHTML +='</p>';
							liHTML +='</div>';
							liHTML +='</a>';
						li.innerHTML = liHTML;
						table.appendChild(li);						
					};
				}, 500);
			};
			if (mui.os.plus) {
				mui.plusReady(function() {
					setTimeout(function() {
						mui('#pullrefresh').pullRefresh().pullupLoading();
					}, 0);
				});
			} else {
				mui.ready(function() {
					mui('#pullrefresh').pullRefresh().pullupLoading();
				});
			}
		</script>
	</body>
</html>